package STUDENT.NGUYENVANSANG;

import java.text.DecimalFormat;
import java.util.Scanner;

public class Mophongmayruttien {
	public static void main(String[] args) {
		DecimalFormat formatter = new DecimalFormat("#,###");
		int money = 0;
		final int FIVE_HUNDRED_THOUSAND = 500000;
		final int TWO_HUNDRED_THOUSAND = 200000;
		final int ONE_HUNDRED_THOUSAND = 100000;
		final int FIFTY_HUNDRED_THOUSAND = 50000;
		final int TWEENTY_HUNDRED_THOUSAND = 20000;
		final int TEN_THOUSAND = 10000;
		int fiveHundredThousand = 0;
		int twoHundredThousand = 0;
		int oneHundredThousand = 0;
		int fiftyHundredThousand = 0;
		int tweentyHundredThousand = 0;
		int tenThousand = 0;
		Scanner sc = new Scanner(System.in);
		
		do {
			System.out.println("Hello to our bank DIVD");
			System.out.println("Xin vui lòng nhập vào số tiền bạn muốn rút ");
			money = sc.nextInt();
			 
		} while (money % 10000 != 0);
		sc.close();
		System.out.println("Mệnh giá số tờ tiền mà bạn sẽ nhận được:");
		System.out.println("..............");
		// 500.000:
//		 formatter.format:hàm này lấy dấu chấm.500000=>500.000
		if (money >= FIVE_HUNDRED_THOUSAND) {
			fiveHundredThousand = money / FIVE_HUNDRED_THOUSAND;
			money = money % FIVE_HUNDRED_THOUSAND;
			System.out.printf("Mệnh giá %s : %dtờ %n", formatter.format(FIVE_HUNDRED_THOUSAND), fiveHundredThousand);
			
		}
		// 200.000:
		if (money >= TWO_HUNDRED_THOUSAND) {
			twoHundredThousand = money / TWO_HUNDRED_THOUSAND;
			money = money % TWO_HUNDRED_THOUSAND;
			System.out.printf("Mệnh giá %s : %dtờ %n", formatter.format(TWO_HUNDRED_THOUSAND), twoHundredThousand);
			
		}
		// 100.000:
		if (money >= ONE_HUNDRED_THOUSAND) {
			oneHundredThousand = money / ONE_HUNDRED_THOUSAND;
			money = money % ONE_HUNDRED_THOUSAND;
			System.out.printf("Mệnh giá %s : %dtờ %n", formatter.format(ONE_HUNDRED_THOUSAND), oneHundredThousand);
			
		}
		// 50.000:
		if (money >= FIFTY_HUNDRED_THOUSAND) {
			fiftyHundredThousand = money / FIFTY_HUNDRED_THOUSAND;
			money = money % FIFTY_HUNDRED_THOUSAND;
			System.out.printf("Mệnh giá %s : %dtờ %n", formatter.format(FIFTY_HUNDRED_THOUSAND), fiftyHundredThousand);
			
		}
		// 20.ooo:
		if (money >= TWEENTY_HUNDRED_THOUSAND) {
			tweentyHundredThousand = money / TWEENTY_HUNDRED_THOUSAND;
			money = money % TWEENTY_HUNDRED_THOUSAND;
			System.out.printf("Mệnh giá %s : %dtờ %n", formatter.format(TWEENTY_HUNDRED_THOUSAND),tweentyHundredThousand);
			
		}
		// 10.000:
		if (money >= TEN_THOUSAND) {
			tenThousand = money / TEN_THOUSAND;
			money = money % TEN_THOUSAND;
			System.out.printf("Mệnh giá %s: %dtờ  %n", formatter.format(TEN_THOUSAND), tenThousand);
			System.out.println("Thank you for using the bank's services:");
		}
	}

}
